package com.example.wendao.model.db.dao;

import androidx.lifecycle.LiveData;
import androidx.paging.DataSource;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import com.example.wendao.model.entity.Goods;

@Dao
public interface GoodsDao {

    @Query("SELECT * FROM goods WHERE goodId = :goodId")
    Goods findGoodById(int goodId);

    @Query("SELECT * FROM goods")
    DataSource.Factory<Integer, Goods> findAllGoods();

    @Query("DELETE FROM goods WHERE goodId = :goodId")
    void deleteGoodById(int goodId);

    @Delete
    void deleteGood(Goods... good);

    @Insert
    void insertGoods(Goods... goods);

    @Update
    void updateGood(Goods goods);

}

